package com.woniu.atms.service.impl;

import com.woniu.atms.entity.G5CarType;
import com.woniu.atms.mapper.CarTypeMapper;
import com.woniu.atms.service.CarTypeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
  *@author LHY
  *@createTime 2022/1/18/11:28
 **/
@Service
public class CarTypeServiceImpl implements CarTypeService {

    @Resource
    private CarTypeMapper carTypeMapper;

    /**
     * 按id查询车辆类型
     * @param id
     * @return
     */
    @Override
    public G5CarType findCarTypeById(int id) {
        return carTypeMapper.findCarTypeById(id);
    }

    /**
     * 查询所有车辆类型
     * @return
     */
    @Override
    public List<G5CarType> findAllCarType() {
        return carTypeMapper.findAllCarType();
    }

    /**
     * 添加车辆类型
     * @param carType
     * @return
     */
    @Override
    public boolean addCarType(G5CarType carType) {
        carType.setIsExit("y");
        return carTypeMapper.addCarType(carType);
    }

    /**
     * 删除车辆类型
     * @param id
     * @return
     */
    @Override
    public boolean deleteCarType(int id) {
        return carTypeMapper.deleteCarType(id);
    }

    /**
     * 根据类型名查询
     * @param name
     * @return
     */
    @Override
    public G5CarType findCarTypeByName(String name) {
        return carTypeMapper.findCarTypeByName(name);
    }
}
